<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:insert="~{admin/header :: header-fragment}"/>
    <link th:href="@{/admin/plugins/froala_editor/css/froala_editor.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/froala_style.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/code_view.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/draggable.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/colors.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/emoticons.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/image_manager.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/image.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/line_breaker.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/table.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/char_counter.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/video.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/fullscreen.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/file.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/quick_insert.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/help.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/third_party/spell_checker.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/froala_editor/css/plugins/special_characters.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/select2-v4.0.13/css/select2.min.css}" rel="stylesheet"/>
    <link th:href="@{/admin/plugins/select2-v4.0.13/css/select2-bootstrap.css}" rel="stylesheet"/>

</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">

    <!-- Navbar -->
    <th:block th:insert="~{admin/header :: navbar-fragment}"/>
    <!-- /.navbar -->

    <!-- Main Sidebar Container -->
    <th:block th:insert="~{admin/sidebar :: sidebar-fragment(${path})}"/>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <div class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-6">
                        <!--                        <h1 class="m-0 text-dark">carousels</h1>-->
                    </div><!-- /.col -->
                    <div class="col-sm-6">
                        <ol class="breadcrumb float-sm-right">
                            <li class="breadcrumb-item"><a href="#">Home</a></li>
                            <li class="breadcrumb-item">商品管理</li>
                            <li class="breadcrumb-item">添加/修改</li>
                        </ol>
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.container-fluid -->
        </div>
        <!-- /.content-header -->

        <!-- Main content -->
        <div class="content">
            <div class="container-fluid">
                <div class="card card-primary card-outline">
                    <div class="card-header">
                        <h3 class="card-title">商品信息编辑</h3>
                    </div>
                    <div class="card-body">
                        <form id="goodsForm" onsubmit="return false;">
                            <div class="form-group form-inline">
                                <label class="control-label">请选择分类：</label>
                                <select class="form-control col-sm-3" id="levelOne"
                                        data-placeholder="请选择分类...">
                                    <th:block th:unless="${null == firstLevelCategories}">
                                        <th:block th:each="c : ${firstLevelCategories}">
                                            <option th:value="${c.categoryId}" th:text="${c.categoryName}"
                                                    th:selected="${null !=firstLevelCategoryId and firstLevelCategoryId==c.categoryId} ?true:false">
                                                >
                                            </option>
                                        </th:block>
                                    </th:block>
                                </select>&nbsp;
                                <select class="form-control col-sm-3"
                                        id="levelTwo"
                                        data-placeholder="请选择分类...">
                                    <th:block th:unless="${null == secondLevelCategories}">
                                        <th:block th:each="c : ${secondLevelCategories}">
                                            <option th:value="${c.categoryId}" th:text="${c.categoryName}"
                                                    th:selected="${null !=secondLevelCategoryId and secondLevelCategoryId==c.categoryId} ?true:false">
                                                >
                                            </option>
                                        </th:block>
                                    </th:block>
                                </select>&nbsp;
                                <select class="form-control col-sm-3"
                                        id="levelThree"
                                        data-placeholder="请选择分类...">
                                    <th:block th:unless="${null == thirdLevelCategories}">
                                        <th:block th:each="c : ${thirdLevelCategories}">
                                            <option th:value="${c.categoryId}" th:text="${c.categoryName}"
                                                    th:selected="${null !=thirdLevelCategoryId and thirdLevelCategoryId==c.categoryId} ?true:false">
                                                >
                                            </option>
                                        </th:block>
                                    </th:block>
                                </select>
                            </div>
                            <div class="form-group form-inline">
                                <input type="hidden" id="goodsId" name="goodsId"
                                       th:value="${goods!=null and goods.goodsId!=null }?${goods.goodsId}: 0">
                                <label for="goodsId" class="control-label">商品名称：</label>
                                <input type="text" class="form-control col-sm-5" id="goodsName" name="goodsName"
                                       placeholder="*请输入商品名称(必填)"
                                       th:value="${goods!=null and goods.goodsName!=null }?${goods.goodsName}: ''"
                                       required="true">
                                &nbsp;&nbsp;
                                <label for="goodsIntro" class="control-label">商品简介：</label>
                                <input type="text" class="form-control col-sm-5" id="goodsIntro" name="goodsIntro"
                                       placeholder="*请输入商品简介(100字以内)"
                                       th:value="${goods!=null and goods.goodsIntro!=null }?${goods.goodsIntro}: ''"
                                       required="true">
                            </div>
                            <div class="form-group form-inline">
                                <label for="originalPrice" class="control-label">商品价格：</label>
                                <input type="number" class="form-control col-sm-5" id="originalPrice"
                                       name="originalPrice"
                                       placeholder="*请输入商品价格"
                                       th:value="${goods!=null and goods.originalPrice!=null }?${goods.originalPrice}"
                                       required="true">
                                &nbsp;&nbsp;
                                <label for="sellingPrice" class="control-label">商品售价：</label>
                                <input type="number" class="form-control col-sm-5" id="sellingPrice"
                                       name="sellingPrice"
                                       placeholder="*请输入商品售价"
                                       th:value="${goods!=null and goods.sellingPrice!=null }?${goods.sellingPrice}"
                                       required="true">
                            </div>
                            <div class="form-group form-inline">
                                <label for="sellingPrice" class="control-label">商品库存：</label>
                                <input type="number" class="form-control col-sm-5" id="stockNum" name="stockNum"
                                       placeholder="*请输入商品库存数"
                                       th:value="${goods!=null and goods.stockNum!=null }?${goods.stockNum}"
                                       required="true">
                                &nbsp;&nbsp;
                                <label for="sellingPrice" class="control-label">商品标签：</label>
                                <select class="form-control col-sm-5 js-example-tags" multiple="multiple" id="tag"
                                        name="tag" placeholder="*请输入商品小标签">
                                    <th:block th:unless="${null == goods}">
                                        <th:block th:each="item : ${#strings.listSplit(goods.tag,'|')}">
                                            <option th:value="${item}" th:text="${item}" selected="selected"></option>
                                        </th:block>
                                    </th:block>
                                </select>
                                <!--                                <input type="text" class="form-control col-sm-5" id="tag" name="tag"-->
                                <!--                                       placeholder="*请输入商品小标签"-->
                                <!--                                       th:value="${goods!=null and goods.tag!=null }?${goods.tag}: ''"-->
                                <!--                                       required="true">-->
                            </div>
                            <div class="form-group">
                                <label class="control-label" for="goodsSellStatusTrue">上架状态：</label>
                                <input name="goodsSellStatus" type="radio" id="goodsSellStatusTrue" checked=true
                                       th:checked="${null==goods||(null !=goods and null !=goods.goodsSellStatus and goods.goodsSellStatus==0)} ?true:false"
                                       value="0"/>&nbsp;上架&nbsp;
                                <input name="goodsSellStatus" type="radio" id="goodsSellStatusFalse" value="1"
                                       th:checked="${null !=goods and null !=goods.goodsSellStatus and goods.goodsSellStatus==1} ?true:false"/>&nbsp;下架&nbsp;
                            </div>
                            <div class="form-group">
                                <div class="col-sm-4">
                                    <img id="goodsCoverImg" th:src="${null == goods} ? @{/admin/dist/img/img-upload.png} : @{${goods.goodsCoverImg}}"
                                         style="width:160px ;height: 160px;display:block;">
                                </div>
                            </div>
                            <br>
                            <div class="form-group">
                                <div class="col-sm-4">
                                    <button class="btn btn-info" style="margin-bottom: 5px;"
                                            id="uploadGoodsCoverImg">
                                        <i class="fa fa-picture-o"></i>&nbsp;上传商品主图
                                    </button>
                                </div>
                            </div>
                            <div class="form-group">
                                <div id="editor"
                                     th:utext="${goods!=null and goods.goodsDetailContent !=null}?${goods.goodsDetailContent}: ''">
                                </div>
                            </div>
                            <div class="form-group">
                                <!-- 按钮 -->
                                &nbsp;<button class="btn btn-info float-right" style="margin-left: 5px;"
                                              id="confirmButton">保存商品
                            </button>&nbsp;
                                &nbsp;<button class="btn btn-secondary float-right" style="margin-left: 5px;"
                                              id="cancelButton">返回商品列表
                            </button>&nbsp;
                            </div>
                        </form>
                    </div>

                </div>
            </div><!-- /.container-fluid -->
        </div>
        <div class="content">
            <!-- 模态框（Modal） -->
            <div class="modal fade" id="goodsModal" tabindex="-1" role="dialog" aria-labelledby="goodsModalLabel">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                    aria-hidden="true">&times;</span></button>
                            <h6 class="modal-title" id="goodsModalLabel">确定要提交吗？</h6>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <button type="button" class="btn btn-primary" id="saveButton">确认</button>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /.modal -->
        </div>
    </div>
    <!-- /.content-wrapper -->
    <!-- 引入页脚footer-fragment -->
    <div th:replace="~{admin/footer::footer-fragment}"></div>
</div>
<!-- jQuery -->
<script th:src="@{/admin/plugins/jquery/jquery.min.js}"></script>
<!-- jQuery UI 1.11.4 -->
<script th:src="@{/admin/plugins/jQueryUI/jquery-ui.min.js}"></script>
<!-- Bootstrap 4 -->
<script th:src="@{/admin/plugins/bootstrap/js/bootstrap.bundle.min.js}"></script>
<!-- AdminLTE App -->
<script th:src="@{/admin/dist/js/adminlte.min.js}"></script>
<!-- sweetalert -->
<script th:src="@{/admin/plugins/sweetalert/sweetalert.min.js}"></script>
<!-- ajaxupload -->
<script th:src="@{/admin/plugins/ajaxupload/ajaxupload.js}"></script>
<!-- froala-editor -->
<script th:src="@{/admin/plugins/froala_editor/js/froala_editor.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/languages/zh_cn.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/align.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/char_counter.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/code_beautifier.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/code_view.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/draggable.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/colors.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/emoticons.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/entities.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/font_size.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/font_family.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/fullscreen.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/image.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/image_manager.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/line_breaker.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/inline_style.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/link.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/lists.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/paragraph_format.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/paragraph_style.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/quick_insert.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/quote.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/table.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/save.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/url.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/video.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/help.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/print.min.js}"></script>
<!--<script th:src="@{/admin/plugins/froala_editor/js/third_party/spell_checker.min.js}"></script>-->
<script th:src="@{/admin/plugins/froala_editor/js/plugins/special_characters.min.js}"></script>
<script th:src="@{/admin/plugins/froala_editor/js/plugins/word_paste.min.js}"></script>
<script th:src="@{/admin/plugins/select2-v4.0.13/js/select2.min.js}"></script>
<script th:src="@{/admin/plugins/select2-v4.0.13/js/i18n/zh-CN.js}"></script>

<script th:src="@{/admin/dist/js/public.js}"></script>
<script th:inline="javascript"> var _ctx = [[@{/}]]; </script>
<script th:src="@{/admin/dist/js/newbee_mall_goods_edit.js}"></script>
</body>
</html>
